<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- Tell the browser to be responsive to screen width -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <!-- Favicon icon -->
    <link rel="icon" type="image/png" sizes="16x16" href="../assets/images/favicon.ico">
    <title>壹脉智能CRM</title>
    <!-- Bootstrap Core CSS -->
    <link href="./css/bootstrap.min.css" rel="stylesheet">
    <link href="./css/style.min.css" rel="stylesheet">
    <link href="./css/colors/default.css" id="theme" rel="stylesheet">
    <link rel="stylesheet" href="./css/diy.min.css">

    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <style>
        .layui-layer-content .layui-layer-btn .layui-layer-btn0 {
            border-color: #dedede;
            background-color: #fff;
            color: #333!important;
        }

        .layui-layer-content .layui-layer-btn .layui-layer-btn1 {
            border-color: #1E9FFF;
            background-color: #1E9FFF;
            color: #fff!important;
        }
    </style>
</head>

<body class="fix-header fix-sidebar card-no-border">
<div class="preloader">
    <div class="loader">
        <div class="loader__figure"></div>
        <p class="loader__label">壹脉</p>
    </div>
</div>
<div id="main-wrapper">
    <header class="topbar">
        <nav class="navbar top-navbar navbar-expand-md navbar-light">
            <div class="navbar-header">
                <a class="navbar-brand" href="/">
                    <b>
                        <img src="../assets/images/diy/yimai.png" alt="homepage" class="dark-logo"/>
                        <!--<img src="../assets/images/logo-light-icon.png" alt="homepage" class="light-logo"/>-->
                    </b>
                    <span>
                        <span class="fs18 cblue p-l-6 fbold">壹脉智能CRM</span>
                    </span>
                </a>
            </div>
            <div class="navbar-collapse">
                <ul class="navbar-nav mr-auto">
                    <li class="nav-item"> <a class="nav-link nav-toggler hidden-md-up waves-effect waves-dark" href="javascript:void(0)"><i class="sl-icon-menu"></i></a> </li>
                    <li class="nav-item"> <a class="nav-link sidebartoggler hidden-sm-down waves-effect waves-dark" href="javascript:void(0)"><i class="sl-icon-menu"></i></a> </li>
                </ul>
                <user-head></user-head>

            </div>
        </nav>
    </header>
    <aside class="left-sidebar">
        <div class="scroll-sidebar">
            <company-position></company-position>
            <nav class="sidebar-nav p-0">
                <c-slider current="8"></c-slider>
            </nav>
        </div>
    </aside>
    <div class="page-wrapper">

        <div class="container-fluid">

            <div class="row page-titles">
                <div class="col-md-5 align-self-center">
                    <h3 class="text-themecolor">到账流水</h3>
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="javascript:void(0)">HOME</a></li>
                        <li class="breadcrumb-item">营销活动</li>
                        <li class="breadcrumb-item">分销</li>
                        <li class="breadcrumb-item active">到账流水</li>
                    </ol>
                </div>
            </div>

            <div class="row bgfff">
                <div class="fbold fs18 c26 p-t-20 p-l-30">已回款<span style="color: #009d29;">{{moneyBack | formatMoney}}</span>元，待回款{{noMoneyBack | formatMoney}}元<span class="c677 fs14 m-l-30" style="font-weight: 100;">注：确认收货后回款才到账</span></div>

                <ul class="nav w100p nav-tabs customtab position-relative" role="tablist">
                    <li class="nav-item" v-for="(v,k) in navs" :key="k">
                        <a class="nav-link curpointer" data-toggle="tab" role="tab"
                           :class="v.id == navs_id ? 'active' : '' "
                           @click="changeNav(v.id)">
                            <span class="hidden-sm-up">
                                <i class="ti-home"></i>
                            </span>
                            <span class="hidden-xs-down">{{v.label}}</span>
                        </a>
                    </li>
                </ul>

                <div class="d-flex p-t-10 w100p p-r-31 p-b-17">

                </div>

                <div class="row w100p p-l-30">
                    <div class="col-12">
                        <div class="card m-b-0">
                            <table id="example24" class="align-cen-table textc display nowrap table table-hover table-bordered bgf6f9fa m-b-20 fixed-table text-ellipsis small-table-padding">
                                <thead>
                                <tr>
                                    <th>订单编号</th>
                                    <th>商品名称</th>
                                    <th>付款金额（元）</th>
                                    <th>分销佣金</th>
                                    <th>实收金额（元）</th>
                                    <th>分销等级</th>
                                    <th>付款时间</th>
                                    <th>付款人姓名</th>
                                    <th>联系方式</th>
                                    <th>订单状态</th>
                                    <th>操作</th>
                                    <th>备注</th>
                                </tr>
                                </thead>
                                <tbody class="bgfff">
                                <tr v-for="(v,k) in accountingRecordslist" :key="k" class="curpointer">
                                    <td>{{v.ordersNo}}</td>
                                    <td>{{v.goodsName}}</td>
                                    <td>{{v.payPrice | formatMoney}}</td>
                                    <td>{{v.royaltyMoney | formatMoney}}</td>
                                    <td>{{v.transferAmount | formatMoney}}</td>
                                    <td>{{v.level}}</td>
                                    <td>{{v.payTime | formatDate('yyyy/MM/dd hh:mm') }}</td>
                                    <td>{{v.nickeName}}</td>
                                    <td>{{v.phone}}</td>
                                    <td :style="{color: v.state == 0 ? '#ff0a0a':''}" class="cblue">{{v.state != 0 ? "已结算" : "结算失败"}}</td>
                                    <td>
                                        <div v-if="v.state == 0" @click="changeState(v)" class="curpointer cblue">更改状态</div>
                                        <template v-else>-</template>
                                    </td>
                                    <td>{{v.state == 2 ? "手动修改为“已结算”" : "-"}}</td>
                                </tr>
                                </tbody>
                            </table>
                            <div class="textc" v-if=" !accountingRecordslist.length || accountingRecordslist.length < 0">暂无数据</div>
                        </div>


                        <!--分页-->
                        <div class="d-flex p-b-50 jsend">
                            <page-helper :page-number="page" :total-count="total" @change="jumpPage"></page-helper>
                        </div>

                    </div>

                </div>
            </div>

        </div>

    </div>
</div>
<!-- All Jquery -->
<!-- ============================================================== -->
<script src="./js/jquery.min.js"></script>

<script src="./js/bootstrap.min.js"></script>
<script src="./js/perfect-scrollbar.jquery.min.js"></script>
<script src="./js/sidebarmenu.js"></script>
<!--Custom JavaScript -->
<script src="./js/custom.min.js"></script>
<script src="./js/layer/layer.js"></script>
<!-- ============================================================== -->

<script src="./js/vue.js"></script>
<script src="./js/config.js"></script><script src="./js/extend.js"></script>
<script>
    $(function () {
        var vw = new Vue({
            el: '#main-wrapper',
            data: {
                accountingRecordslist: [], // 提现记录列表
                state: '',
                total: 0,
                page: 1,
                moneyBack: 0,
                noMoneyBack: 0,
                navs_id: '',
                navs: [
                    { id: '', label: '全部订单' },
                    { id: '0', label: '结算失败' },
                    { id: '1', label: '已结算' },
                ]
            },
            mounted() {
                this.getAccountingRecordslist();
            },
            methods:{
                changeNav(id){
                    this.page = 1;
                    this.navs_id = id;
                    this.getAccountingRecordslist();
                },
                changeState(v){
                    let _this = this;
                    let layer1 =  layer.open({
                        title: '更改结算状态',
                        content: '<div>是否手动更改订单状态<div><div>由原有的<span style="color: #ff0a0a;">结算失败</span>改为<span class="cblue">已结算</span></div>'
                        ,btn: ['取消', '确认']
                        ,btn1: function(index, layero){
                            layer.close(layer1);
                        }
                        ,btn2: function(index, layero){
                            $.cAjax('/crmPc/distribution/updateCompanyTransferState', {
                                data:{
                                    transferId: v.transferId
                                }
                            }).then(res => {
                                if(res) {
                                    _this.getAccountingRecordslist();
                                }
                            }).catch(err => {

                            })
                        }
                    });
                },
                stateChange(){
                    this.getAccountingRecordslist();
                },
                getAccountingRecordslist(){
                    $.cAjax('/crmPc/distribution/selectCompanyTransferList', {
                        data:{
                            pageNum: this.page,
                            state: this.navs_id
                        }
                    }).then(res=>{
                        if (res){
                            this.accountingRecordslist = res.pageInfo.list;
                            this.total = res.pageInfo.total;
                            this.moneyBack = res.moneyBack;
                            this.noMoneyBack = res.noMoneyBack;
                        }else{
                            this.accountingRecordslist = [];
                            this.total = 0;
                        }
                    }).catch(err => {
                        this.accountingRecordslist = [];
                        this.total = 0;
                    })
                },
                jumpPage({currentPage}){
                    this.page = currentPage;
                    this.getAccountingRecordslist();
                }
            }
        })
    })
</script>
</body>
</html>












